#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time   : 2021/6/23 21:47
# @Author : cjw
from os.path import join, dirname

# 企业微信登录地址
WORK_WEI_XIN_URL = 'https://work.weixin.qq.com/wework_admin/loginpage_wx'
# 远程启动服务URL
COMMAND_EXECUTOR = 'http://127.0.0.1:4444/wd/hub'

# --------------------------项目包和文件夹的路径-------------------------------
# 项目根目录
BASE_PATH = dirname(__file__)
# result结果目录
RESULT_PATH = join(BASE_PATH, 'result')
# allure报告目录
REPORT_PATH = join(BASE_PATH, 'report')
# log目录路径
LOG_PATH = join(BASE_PATH, 'log')

# 浏览器驱动地址
CHROME_DRIVER_PATH = join(BASE_PATH, 'browser', 'driver', 'chromedriver246.exe')
FIREFOX_DRIVER_PATH = join(BASE_PATH, 'browser', 'driver', 'geckodriver.exe')
EDGE_DRIVER_PATH = join(BASE_PATH, 'browser', 'driver', 'msedgedriver.exe')

"""YAML文件"""
# 元素定位文件
ELEMENT_YAML_PATH = join(BASE_PATH, 'page', 'locator_yml')
COOKIES_YML = join(ELEMENT_YAML_PATH, 'cookies.yml')
ELEMENT_YML = {
	'mp': join(ELEMENT_YAML_PATH, 'main_page.yml'),
	'cp': join(ELEMENT_YAML_PATH, 'contact_page.yml'),
	'amp': join(ELEMENT_YAML_PATH, 'add_member_page.yml'),
	'adp': join(ELEMENT_YAML_PATH, 'add_department_page.yml')
}

# 数据文件
DATA_YAML_PATH = join(BASE_PATH, 'case', 'data_yml')
DATA_YML = {
	'am': join(DATA_YAML_PATH, 'add_member_page.yml'),
	'ad': join(DATA_YAML_PATH, 'add_department.yml')
}
# -------------------------------浏览器对象属性----------------------------------
"""浏览器共有属性"""
# 无头化
HEADLESS = False

# 隐式等待时间
IMPLICIT_WAIT_TIME = 5
# 显示等待时间
WEBDRIVER_WAIT_TIMEOUT = 10
# 页面加载超时时间
PAGE_LOAD_TIME = 10
# JS异步执行超时时间
SCRIPT_TIMEOUT = 10
# 浏览器启动尺寸
WINDOWS_SIZE = (1920, 1024)

"""谷歌浏览器特有属性"""
# 浏览器特性操作开关
CHROME_METHOD_MARK = True
# 启动参数开关
CHROME_OPTION_MARK = True
# 实验选项参数
CHROME_EXPERIMENTAL_OPTION = {
	'excludeSwitches': ['enable-automation'],  # 不显示自动化软件控制提示
	# 以移动手机型号打开网页，测试H5网页有用
	# 'mobileEmulation': {'deviceName': 'iPhone 6'},
	'prefs': {  # 取消密码自动保存提示
		'credentials_enable_service': False,
		'profile.password_manager_enabled': False
	}
}
# 复用浏览器地址
DEBUGGER_ADDRESS = '127.0.0.1:9222'
# 是否复用浏览器
IS_DEBUGGER = False
# 窗口大小启动参数
CHROME_WINDOW_SIZE = (1920, 900)
# 启动窗口最大化
CHROME_START_MAXIMIZED = '--start-maximized'

# WEB元素定位方式
BY_RULES = ('id', 'xpath', 'link text', 'partial link text',
            'name', 'tag name', 'class name', 'css selector')